{% extends "team/dashboard_base.html" %}

{% block subcontainer %}

  <div class="pulls bubble">
    <div class="header">
      <h2 class="heading">需要我处理的</h2>
      <span class="sortable btn-group">
        <a id="pullMerge" href="/{{teamUser.username}}/-/dashboard/pull/merge/" class="btn btn-mini btn-disable first">需要我处理的</a>
        <a id="pullRequest"href="/{{teamUser.username}}/-/dashboard/pull/request/" class="btn btn-mini last">我创建的</a>
      </span>
    </div>

    {% if pullRequests %}
      {% for pullRequest in pullRequests %}
        <section class="pull-item">
            <div class="widget">
              <span class="status {{pullRequest.status_label}}">{{pullRequest.status_view}}</span>
              <span class="branches">
                <a href="/{{pullRequest.source_repo.username}}/{{pullRequest.source_repo.name}}/tree/{{pullRequest.source_refname}}/" class="from branch">{{pullRequest.source_refname}}</a>
                <span class="arrow-right"><i class="icon-long-arrow-right"></i></span>
                <a href="/{{pullRequest.desc_repo.username}}/{{pullRequest.desc_repo.name}}/tree/{{pullRequest.desc_refname}}/" class="to branch">{{pullRequest.desc_refname}}</a>
              </span>
            </div>
            <div class="summary">
              <h3 class="heading">
                <a href="/{{pullRequest.desc_repo.username}}/{{pullRequest.desc_repo.name}}/pull/{{pullRequest.id}}/">{{pullRequest.short_title}}</a>
                <a href="/{{pullRequest.desc_repo.username}}/{{pullRequest.desc_repo.name}}/pull/{{pullRequest.id}}/" class="id">#{{pullRequest.id}}</a>
              </h3>
              <div class="desc">
                <p>{{pullRequest.short_desc}}</p>
              </div>
              <div class="meta">
                <a href="/{{pullRequest.pull_user.username}}/">{{pullRequest.pull_user.username}}</a>
                <time class="unixtime" pubdate="pubdate">{{pullRequest.modify_time|date:"U"}}</time>
              </div>
            </div>
        </section>
      {% endfor %}
    {% else %}
      <div class="inner">
        <p class="alert blank-alert"><i class="icon-bell"></i><em>没有合并请求需要处理</em></p>
      </div>
    {% endif %}

  </div>


{% endblock %}

{% block js %}
  <script>
    $(function(){
        moment.lang('zh-cn');
        $('#pullMerge').click(function(){
            window.location.href = '/dashboard/pull/';
        });
        $('#pullRequest').click(function(){
            window.location.href = '/dashboard/pull/request/';
        });
    });
  </script>
{% endblock %}
